package com.css.fxfzdzzh.zcpt.sys.service.impl;

import com.css.fxfzdzzh.zcpt.sys.service.SysDeptService;
import com.css.fxfzdzzh.util.RestTemplateUtil;
import org.slw.common.helper.PropsHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

@Service
public class SysDeptServiceImpl implements SysDeptService {

    @Autowired
    private  RestTemplateUtil restTemplateUtil;

    @Override
    public String getMainDeptByUserId(String  userId) {
        //读取配置文件
        Properties configGroup = PropsHelper.loadProps("slw-config.properties");
        String url = configGroup.getProperty("baseRestUrl") + "/sorg_dzj/getSOrgByUserIdMain?userId="+userId;
        Map<String, Object> paramMap = new HashMap<>(10);
        paramMap.put("userId",userId);
        ResponseEntity<String> responseEntity = restTemplateUtil.sendHttpRequest(url, paramMap);
        return  responseEntity.getBody();
    }
}
